<template>
  <div class="icon-box">{{ showDate }}</div>
</template>

<script setup lang="ts">
import { defineProps, computed } from "vue";
import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";
// 扩展dayjs插件
dayjs.extend(utc);
dayjs.extend(timezone);
const props = defineProps({
  value: {
    type: Number,
    default: 0
  }
});
const showDate = computed(() => {
  if (props.value > 0) {
    // 智利时区 (考虑夏令时)
    return dayjs.unix(props.value).tz("America/Santiago").format("YYYY-MM-DD HH:mm:ss");
  }
  return "";
});
</script>
